<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<h1><fmt:message key="menu.top.item.search.caption" /></h1>
<form action="/museum/search" method="post">
	<label style="width: 250px;" for="query"><fmt:message key="page.search.query" />:</label>
	<input name="query" type="text" />
	<input type="submit" value="Trazi" />
	
	<c:choose>
		<c:when test="${not empty result}">
			<div id="item-list">
				<table>
					<thead>
						<tr>
							<th>ID</th>
							<th>Name</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${result}" var="item" varStatus="status">
							<tr class="${(status.count % 2 == 0) ? 'even' : 'odd'}${status.last ? ' last' : ''}">
								<td><a href="preview/${item.inventaryNumber.value}">${item.inventaryNumber.value}</a></td>
								<td><a href="preview/${item.inventaryNumber.value}">${item.subject.value}</a></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
		</c:when>
	</c:choose>
</form>